fix(jsonl): map lifecycle guard errors to invalid_request#449
fix(jsonl): map lifecycle guard errors to invalid_request#449dalledajay-coder wants to merge 1 commit into
Conversation
|
Warning Review limit reached
Next review available in: 57 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
handle_request caught ValueError, ProposalError and ArtifactNotFoundError as caller-visible conditions, but LifecycleError (a RuntimeError subclass like ProposalError) fell through to the generic branch: kb.supersede of a claim onto itself came back as internal_error and logged a full server-side traceback for what is a bad request. the http /rpc transport shares the same envelope, so both wire surfaces misreported it while the cli already mapped the identical error to a clean one-liner via _cli_errors. add LifecycleError to the domain-error tuple so lifecycle guards surface as invalid_request on every transport, and cover it with a regression test that fails on the previous code.
2ca2f62 to
66ad6e8
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
What changed
handle_requestin the JSONL server now includesLifecycleErrorin the caller-visible domain-error tuple, next toProposalError, so lifecycle guard failures map to{"code": "invalid_request"}instead of falling through to the genericinternal_errorbranch. one import, one tuple entry, a regression test, and a changelog line.Why
the envelope treated
ValueError/ProposalError/ArtifactNotFoundErroras bad requests, butLifecycleError— aRuntimeErrorsubclass exactly likeProposalError— fell through to the catch-all. on currenttest:plus
_log.exceptiondumping a full server-side traceback for what is a caller mistake. the http/rpctransport routes through the samehandle_request, so both wire surfaces misreported it — while the cli already translated the identical error into a clean one-liner via_cli_errors(which listsLifecycleErrorexplicitly for this exact reason). an agent retrying oninternal_error(a server fault, plausibly transient) will loop on a request that can never succeed;invalid_requesttells it the request itself is wrong.any future lifecycle guard raising
LifecycleErrorgets the correct mapping for free.Testing
tests/test_jsonl_server.py::test_jsonl_lifecycle_guard_maps_to_invalid_request— fails on currenttest(envelope carriesinternal_error), passes with the fix; also asserts the guard fired before any write, leaving the claim untouched.ran locally: